import java.util.Calendar;

public class CalendarDemo01 {
    public static void main(String[] args) {
        //通过静态方法getInstance( )获得Calendar类的对象,实际上，获得的是它的子类的对象。
        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH);
        int date = calendar.get(Calendar.DATE);
        int hour = calendar.get(Calendar.HOUR);
        int minute = calendar.get(Calendar.MINUTE);
        int second = calendar.get(Calendar.SECOND);
        int week = calendar.get(Calendar.DAY_OF_WEEK);
        int day = calendar.get(Calendar.DAY_OF_MONTH);

//        System.out.println(year);
//        System.out.println(month);
//        System.out.println(date);
//        System.out.println(hour);
//        System.out.println(minute);
//        System.out.println(second);
//        System.out.println(week);
//        System.out.println(day);
        StringBuffer sb = new StringBuffer("今天是");
        System.out.println(year + "年" + (month+1) + "月" + date + "日");
        System.out.println(sb.toString()+ year + "年" + (month+1) + "月" + date + "日");
        sb.append(year).append("年").append(month+1).append("月").append(date).append("日").append(hour).append("时").append(minute).append("分").append(second).append("秒").append(" ").append("星期").append(week-1).append(" ").append((month+1)).append("月的第").append(day).append("天");
        System.out.println(sb);
        System.out.println(sb.toString() );

    }
}
